-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
common Paint: Add name getter/setter API #1285
Conversation
This is a simple solution for #1276. |
Maybe a hashed string can be stored instead of the actual string itself? something like |
And if the user wants to have a full blown svg "reflection", he can just use a different svg parser building the tree and use the hashed ids coming from thorgvg paint->getPaintId() for lookup in the svg dom retrieving more detailed info like classes, hrefs, or the actual id string. The PaintId can be auto generated as well if it is not coming from and svg for consistency (but this is just a suggestion) |
Rebased PR |
Adds an API that can set/get string type name to tvgPaint. This can be used when the user needs to traverse the scene tree or find a specific instance. +) The SVG's "id" attribute is set to name when SVG is loaded.
@hermet Do you have any comments for updates? At the time this patch was written, it wasn't a necessary thing. There were comments related to hashing, but I can't pay attention to them for a long time. (If hashing, it can be used more widly, but for now, I think it is over-spec. It can be sufficiently improved in the future.) |
@JSUYA I agree with @kariem2k's opinion; ThorVG could save memory in general cases if it has a name with a single reference id. Thus, the usage would be something like this
Yet my question is whether |
It is not necessary to return it as a string. We can use |
If ThorVG should support value recovery, then I guess hashing wouldn't be beneficial. |
Oh I've been waiting for your opinion since i think this discussion is not conclusive. I checked the contents of the I'm closing this PR. If a feature related to this(string type return) is needed, it can be discussed again in a new place other than this PR. |
Adds an API that can set/get string type name to tvgPaint.
This can be used when the user needs to traverse the scene tree or find a specific instance.
+) The SVG's "id" attribute is set to name when SVG is loaded.
Issue: